﻿using System;
using System.Collections.Generic;
using System.Text;
using Lottery.App.Core;
using System.Text.RegularExpressions;

namespace Lottery.App.Test
{
    class K3
    {
        WebUtils web = new WebUtils();

        public DateTime MethodName()
        {
            return DateTime.Now.AddDays(-81);
        }

        public void GetShowPage()
        {
            string url = "http://www.jlfc.com.cn/kaijiang/?item=history&lotteryid=700&pagesize=10&pageoffset=1";

            string result = web.DoGet(url, null);

            int startIndex = result.IndexOf("中奖号码");
            int endIndex = result.IndexOf("条记录");

            result = result.Substring(startIndex, endIndex - startIndex);

            Regex reg_qh = new Regex(@"(\d{9})");
            foreach (Match item in reg_qh.Matches(result))
            {
                System.Diagnostics.Debug.WriteLine(item.Value);
            }

            string tmp = String.Empty;
            Regex reg_value = new Regex(@">(\d{2})<");
            MatchCollection mc = reg_value.Matches(result);
            for (int i = 9; i >= 0; i--)
            {
                tmp = String.Format("{0} {1} {2}",
                    mc[i * 3].Groups[1].Value, 
                    mc[i * 3 + 1].Groups[1].Value, 
                    mc[i * 3 + 2].Groups[1].Value);

                System.Diagnostics.Debug.WriteLine(tmp);
            }
            

            //if (mc.Count == 0 || mc.Count != 672) { }


        }


    }
}
